﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;


namespace Puzzles_IQ
{
    class MenuHelper
    {
        public string[] GetFolders(string directory)
        {
            return Directory.GetDirectories(directory.AddApplicationPath());
        }

        public IEnumerable<string> GetFiles(string directory)
        {
            foreach (string fi in Directory.GetFiles(directory))
            {
                if (fi.Substring(fi.LastIndexOf('.') + 1) != "rtf")
                {
                    yield return fi;
                }
            }
        }

        public string GetRandomSample()
        {
            Random r = new Random();
            int rand = r.Next((GetFiles("Collections\\Samples".AddApplicationPath())).Count() - 1);
            return (GetFiles("Collections\\Samples".AddApplicationPath())).ElementAt(rand);
        }

    }

}
